package com.wcgksoft.entity.system;

import com.fasterxml.jackson.annotation.JsonBackReference;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @author 阿良
 * @version 1.0.0
 * @ClassName Enterprise.java
 * @Description 企业实体
 * @createTime 2020年03月05日 10:02:00
 */
@Entity
@Table(name = "Sys_Enterprise")
public class Enterprise {

  /**
   * id
   */
  @Id
  @Basic(optional = false)
  @GeneratedValue(strategy = GenerationType.IDENTITY)
  @Column(name = "id", nullable = false)
  private Integer id;

  /**
   * 企业的项目
   */
  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "enterprise")
  @Fetch(FetchMode.SUBSELECT)
  @JsonBackReference
  private List<EnterpriseProject> enterpriseProjectList = new ArrayList<>();


  /**
   * 企业登录账号
   */
  @Column(name = "loginaccount", length = 100)
  private String loginaccount;

  /**
   * 企业用户id
   */
  @Column(name = "sysbaseid", length = 100)
  private String sysbaseid;

  /**
   * 企业登录密码
   */
  @Column(name = "loginpsd", length = 100)
  private String loginpsd;

  /**
   * 企业logo图片
   */
  @Column(name = "image", length = 100)
  private String image;

  /**
   * 机构名称
   */
  @Column(name = "departname", length = 100)
  private String departName;

  /**
   * 上级企业ID,自链接
   */
  @Column(name = "parentdepartid", length = 32)
  private String parentdepartId;


  /**
   * 企业联系人
   */
  @Column(name = "contacts", length = 32)
  private String contacts;
  /**
   * 企业邮箱
   */
  @Column(name = "email", length = 32)
  private String email;
  /**
   * 手机号
   */
  @Column(name = "mobile", length = 32)
  private String mobile;
  /**
   * 描述
   */
  @Column(name = "description", length = 800)
  private String description;
  /**
   * 注册资金
   */
  @Column(name = "capital", length = 800)
  private String capital;

  /**
   * 地址
   */
  @Column(name = "address", length = 100)
  private String address;
  /**
   * 创建人
   */
  @Column(name = "create_name", length = 100)
  private String CreateName;

  /**
   * 创建时间
   */
  @Column(name = "create_date", length = 100)
  private Date CreateDate;

  /**
   * 关联版本
   */
  @OneToOne(fetch = FetchType.EAGER, optional = true)
  @JoinColumn(name = "version_id", nullable = true)
  @Cascade({org.hibernate.annotations.CascadeType.REFRESH})
  private SystemVersion systemVersion;


  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public List<EnterpriseProject> getEnterpriseProjectList() {
    return enterpriseProjectList;
  }

  public void setEnterpriseProjectList(List<EnterpriseProject> enterpriseProjectList) {
    this.enterpriseProjectList = enterpriseProjectList;
  }

  public String getCapital() {
    return capital;
  }

  public void setCapital(String capital) {
    this.capital = capital;
  }

  public String getLoginaccount() {
    return loginaccount;
  }

  public void setLoginaccount(String loginaccount) {
    this.loginaccount = loginaccount;
  }

  public String getSysbaseid() {
    return sysbaseid;
  }

  public void setSysbaseid(String sysbaseid) {
    this.sysbaseid = sysbaseid;
  }

  public String getLoginpsd() {
    return loginpsd;
  }

  public void setLoginpsd(String loginpsd) {
    this.loginpsd = loginpsd;
  }

  public String getImage() {
    return image;
  }

  public void setImage(String image) {
    this.image = image;
  }

  public String getDepartName() {
    return departName;
  }

  public void setDepartName(String departName) {
    this.departName = departName;
  }

  public String getParentdepartId() {
    return parentdepartId;
  }

  public void setParentdepartId(String parentdepartId) {
    this.parentdepartId = parentdepartId;
  }

  public String getContacts() {
    return contacts;
  }

  public void setContacts(String contacts) {
    this.contacts = contacts;
  }

  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  public String getMobile() {
    return mobile;
  }

  public void setMobile(String mobile) {
    this.mobile = mobile;
  }

  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getAddress() {
    return address;
  }

  public void setAddress(String address) {
    this.address = address;
  }

  public String getCreateName() {
    return CreateName;
  }

  public void setCreateName(String createName) {
    CreateName = createName;
  }

  public Date getCreateDate() {
    return CreateDate;
  }

  public void setCreateDate(Date createDate) {
    CreateDate = createDate;
  }

  public SystemVersion getSystemVersion() {
    return systemVersion;
  }

  public void setSystemVersion(SystemVersion systemVersion) {
    this.systemVersion = systemVersion;
  }
}
